package org.example.account.controller;

import org.example.account.model.AccountTbl;
import org.example.account.service.AccountTblService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AccountTblController {

    @Autowired
    private AccountTblService accountTblService;

    //测试请求
    @GetMapping("/accountTest")
    public String accountTest() {
        List<AccountTbl> list = accountTblService.list();
        return "account中一共有：" + list.size() + "数据";
    }

    @GetMapping("/updateAccount")
    public String update(@RequestParam Integer accountId, @RequestParam Integer money) {
        accountTblService.updateByAccountId(accountId, money);
        return "更新成功";
    }
}
